package com.tm.d3_exception;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;

/**
 * 2024/6/2 Cjj 异常案例
 */
public class Exception {

    public Exception(String message) {
    }

    public static void main(String[] args) throws ParseException {
       // Integer.valueOf("abc");
        //运行时异常
        System.out.println(Integer.valueOf(1));
        //Integer.valueOf("哇啊");

     //   int [] arr={1,2,3};
      //  System.out.println(arr[4]); 运行时异常

        int [] arr={1,2,3};
        System.out.println(arr[2]);//3
        //编译时异常
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Date date = format.parse("2024-2-5");
        System.out.println(date);
        System.out.println(Arrays.toString(arr));
    }
}

